~(function() {
	document.browser = getBrowser();
	document.browserVersion = getBrowser().version;
	document.os = getOS();

	function getBrowser() {
		var sys = {};
		var ua = navigator.userAgent.toLowerCase();
		var s;
		(s = ua.match(/edge\/([\d.]+)/)) ? sys.edge = s[1] : (s = ua.match(/rv:([\d.]+)\) like gecko/)) ? sys.ie = s[1] : (s = ua.match(/msie ([\d.]+)/)) ? sys.ie = s[1] : (s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] : (s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] : (s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] : (s = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0;

		if (sys.edge)
			return {
				name : "Edge",
				version : sys.edge
			};
		if (sys.ie)
			return {
				name : "IE",
				version : sys.ie
			};
		if (sys.firefox)
			return {
				name : "Firefox",
				version : sys.firefox
			};
		if (sys.chrome)
			return {
				name : "Chrome",
				version : sys.chrome
			};
		if (sys.opera)
			return {
				name : "Opera",
				version : sys.opera
			};
		if (sys.safari)
			return {
				name : "Safari",
				version : sys.safari
			};

		return {
			name : "unknown",
			version : "0"
		};
	}

	function getOS() {
		var userAgent = window.navigator.userAgent.toLowerCase();
		if (userAgent.indexOf("mac os") !== -1) {
			return 'Mac';
		}
		if (userAgent.indexOf('android')) {
			return 'Android';
		}
		return 'Windows'
	}
})();
